package cn.iocoder.yudao.module.system.dal.mysql.erp.warehouse;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.erp.warehouse.vo.WarehousePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.erp.warehouse.WarehouseDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 仓库管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {

    default PageResult<WarehouseDO> selectPage(WarehousePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WarehouseDO>()
                .betweenIfPresent(WarehouseDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(WarehouseDO::getName, reqVO.getName())
                .eqIfPresent(WarehouseDO::getAddress, reqVO.getAddress())
                .eqIfPresent(WarehouseDO::getExtent, reqVO.getExtent())
                .eqIfPresent(WarehouseDO::getRemake, reqVO.getRemake())
                .eqIfPresent(WarehouseDO::getRent, reqVO.getRent())
                .orderByDesc(WarehouseDO::getId));
    }

}